<%@ page pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="aa" uri="http://ajaxanywhere.sourceforge.net/" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><fmt:message key="switchRecordList.title"/></title> 
<script src="<c:url value='/scripts/common.js'/>"></script> 
<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/interface/SwitchRecordRemote.js'></script>
<script src="<c:url value='/scripts/ajax/aa.js'/>"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link rel="stylesheet" type="text/css" media="all"	href="<c:url value='/styles/layout.css'/>" />
<script src="<c:url value="/scripts/date.js"/>" language="javascript"></script>
</head>

<body leftmargin="0" topmargin="0"><br>
<html:form action="switchRecord">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td class="home-content-title"><img src="images/home_ico_listTitle.gif" width="22" height="20" align="absmiddle">旅客签转信息管理<br></td>
  </tr>

 
   <tr> 
    <td valign="top"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td class="home-table-topline"></td>
        </tr>
        <tr> 
          <td class="home-table-leftline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-tool-content">
		<input name="Submit32" type="button" class="home-inputBtn" onClick="back();" value="返回">
		<input type="button" 
                class="home-table-inputbox"
        		onclick="batchEdit('selected_id')"
        		value="<fmt:message key="button.batchEdit"/>"/></td>
              </tr>
              <tr>
                <td align="center" valign="top">&nbsp;<br></td>
              </tr>
              <tr> 
                <td valign="top" class="home-edittable-space"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td><table width="100%" border="0" cellpadding="4" cellspacing="1" class="home-subtable-bgcolor">
                           <input  type="hidden" name="flightInfoId" value="<c:out value='${param.flightInfoId }'/>"/>
                         
                          <tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">航班号：</td>
                            <td width="30%" class="home-subtable-view-tdstyle-left"><c:out value="${flightInfo.flightNum}"/></td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">日期：</td>
                            <td width="30%" class="home-subtable-view-tdstyle-left"><fmt:formatDate value="${flightInfo.flightDate}" pattern="yyyy-MM-dd"/></td>
                          </tr>
                          <tr> 
                            <td class="home-subtable-view-tdstyle-right">始发站：</td>
                            <td class="home-subtable-view-tdstyle-left"><c:out value="${flightInfo.depaName}"/></td>
                            <td class="home-subtable-view-tdstyle-right">终点站：</td>
                            <td class="home-subtable-view-tdstyle-left"><c:out value="${flightInfo.arrName}"/></td>
                          </tr>
                          <tr> 
                            <td class="home-subtable-view-tdstyle-right">计划起飞日期/时间：</td>
                            <td class="home-subtable-view-tdstyle-left"><fmt:formatDate value="${flightInfo.std}" pattern="yyyy-MM-dd HH:mm"/></td>
                            <td class="home-subtable-view-tdstyle-right">预计起飞日期/时间：</td>
                            <td class="home-subtable-view-tdstyle-left"><fmt:formatDate value="${flightInfo.etd}" pattern="yyyy-MM-dd HH:mm"/></td>
                          </tr>
                        </table></td>
                    </tr>

                    <tr> 
                      <td>&nbsp;</td>
                    </tr>
                    <tr> 
                      <td class="home-table-tool-content">签转记录</td>
                    </tr>
					<%--
					<tr> 
					  <td> 
						<input type="button"   class="home-table-inputbox" 
        		            onclick="window.open('./switchRecord.html?method=editAddForm&flightInfoId=<c:out value="${param.flightInfoId}"/>&passengerInfoId=<c:out value="${param.passengerInfoId}"/>',null,'top=200,height=320,width=550,status=no,toolbar=no,menubar=no,location=no')"
        		            value="<fmt:message key="button.add"/>"/>
                        <input name="button" type="button" class="home-inputBtn" value="删除" onclick="deleteRecord()"> 
					  </td>
					</tr> 
					--%>
					<tr> 
						<td valign="top" class="home-tab-line"> 
					<aa:zone name="recordZone">
						<table width="100%" border="0" cellpadding="2" cellspacing="0" class="list_bordercolor" >
                     
                     <tr> 
                       <td colspan="10" class="home-table-tool-content02"><sasis:page items="${switchRecordList}"/></td>
                     </tr>	
                    <tr> 
                      <td width="6%" class="home-list-title"><div align="center"> 
                          <input type="checkbox" name="checkbox" value="checkbox" onclick="chooseAll(this)" />
                        </div></td>
                   
                
                      <td  width="10%" class="home-list-title">&nbsp;旅客姓名</td>
                      <td  width="12%" class="home-list-title">&nbsp;票号</td>
                      <td  width="10%" class="home-list-title">&nbsp;处理</td>
                      <td  width="10%" class="home-list-title">&nbsp;产生费用</td>
                      <td  width="10%" class="home-list-title">&nbsp;签转航班号</td>
                      
                      <td  width="15%" class="home-list-title">&nbsp;签转后票号</td>
                      <td  width="18%" class="home-list-title">&nbsp;备注</td>
                      <td class="home-list-title" width="50">&nbsp;<fmt:message key="button.edit"/></td>		   				 
		              <td class="home-list-title"  width="50">&nbsp;<fmt:message key="button.view"/></td>
                     </tr> 
		 	 	
                    
                    <c:forEach var="results" items="${switchRecordList}" varStatus="status">
                    <tr>
                      <td class="home-list-content"><div align="center"> 
                        <input type="checkbox" name="selected_id" value="<c:out value='${results.id}'/>,<c:out value='${results.pi_id}'/>" />
                      </td>
                     <%-- <td class="home-list-content">&nbsp;<c:out value="${results.id}"/></td>
                      <td class="home-list-content">&nbsp;<c:out value="${results.pi_id}"/></td>--%>
                      
                      <td class="home-list-content">&nbsp;<c:out value="${results.chineseName}"/></td>
                      <td class="home-list-content">&nbsp;<c:out value="${results.etNumber}"/></td>
                      <td class="home-list-content">&nbsp;
                         <c:if test="${results.switchType==1}">退票</c:if>
                         <c:if test="${results.switchType==2}">变更</c:if>
                         <c:if test="${results.switchType==3}">签转</c:if></td>
                      <td class="home-list-content">&nbsp;<c:out value="${results.cost}"/></td>   
                      <td class="home-list-content">&nbsp;<c:out value="${results.switchFlightNum}"/></td>
                      <td class="home-list-content">&nbsp;<c:out value="${results.switchEtNum}"/></td>
                      <td class="home-list-content" style="word-break:break-all">&nbsp;<c:out value="${results.memo}"/></td>
                      
                    <td class="home-list-content" width="50">&nbsp;
		    	           <img src="./images/edit.gif" width="14" height="14" style="cursor:hand"  alt="<fmt:message key="button.edit"/>" 
		    	           onclick="window.open('./switchRecord.html?method=editAddForm&pi_id=<c:out value="${results.pi_id}"/>&flightInfoId=<c:out value="${param.flightInfoId}"/>',null,'top=200,left=240,height=320,width=550,status=no,toolbar=no,menubar=no,location=no scrollbars=yes')">&nbsp;
		                 </td>
		             <td class="home-list-content" width="50">&nbsp;
		    	<img src="./images/view.gif" width="14" height="14" style="cursor:hand"  alt="<fmt:message key="button.view"/>"  onClick="MM_openBrWindow('./switchRecord.html?method=view&pi_id=<c:out value="${results.pi_id}"/>','','width=500,height=300')" >&nbsp;
		    </td>     
                     
                    </tr>
		</c:forEach> 
                  </table>
		</aa:zone>			
						</td>
					</tr>

                  </table> 
                  
                </td>
              </tr>
            </table>
		  </td>
        </tr>
        <tr> 
          <td height="12">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-bottom-left">&nbsp;</td>
                <td class="home-table-bottom-bg">&nbsp;</td>
                <td class="home-table-bottom-right">&nbsp;</td>
              </tr>
            </table></td>

        </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="10">&nbsp;</td>
  </tr>
</table>
</html:form>
</body>
<script>
//written by kellen 07-04-19
function back(){
  //switchRecordForm.method="post";
  //switchRecordForm.action="./switchRecord.html?method=back";
  //switchRecordForm.submit();
  window.location.href="./flightInfo.html?abnomal=isAbnomal";
}
function deleteRecord(){
  
  var elements = document.getElementsByName("selected_id");
  var selected=new Array();
  for (var i=0;i <elements.length; i++){
     var e = elements[i];
     if(e.checked){
         var bb = e.value; 
		selected.push(bb);
	 }
  }
  if(confirm("确实要删除?")){
   SwitchRecordRemote.deleteRecord(selected,deleteRecordCallBack);
  }else{
			alert("<fmt:message key="common.delete.message"/>");
		}	
  }	
  function deleteRecordCallBack(bln){
	if(bln){
	
	       ajaxAnywhere.getZonesToReload = function() {
    return "recordZone";
	}
	ajaxAnywhere.getAJAX('switchRecord.html?method=switchRecordManager&flightInfoId=<c:out value="${param.flightInfoId}"/>','recordZone')
	}
}
function doDelete(chkName){  
		var selected = new Array(); 
		var val = "";	  
		   for (var i=0;i < document.forms[0].elements.length; i++){
				var e = document.forms[0].elements[i];  
				if (e.name==chkName){
					var chk = document.forms[0].elements[i];
					if(chk.checked){
						var bb = e.value; 
					    	selected.push(bb);
					    	break;
					} 
				}	 
			}	 
 		if(0!=selected.length){
 			if(confirm("<fmt:message key="common.confirm.message"/>")){  
				document.forms[0].method="post";
				document.forms[0].action="./switchRecord.html?method=delete";
				document.forms[0].submit();
			}else return;	  			
		}else{
			alert("<fmt:message key="common.delete.message"/>");
		}	 
	}

 function saveRecord(){ 
	ajaxAnywhere.getZonesToReload = function() {
    return "recordZone";
	}
	ajaxAnywhere.getAJAX('switchRecord.html?method=switchRecordManager&flightInfoId=<c:out value="${param.flightInfoId}"/>&passengerInfoId=<c:out value="${param.passengerInfoId}"/>','recordZone')
     //ajaxAnywhere.submitAJAX(); 
}
//added by liuhao 2008-9-6	
function batchEdit(chkName){ 
        var f_a_ID=""; 
		var selected = new Array(); 
		var val = "";	  
		   for (var i=0;i < document.forms[0].elements.length; i++){
				var e = document.forms[0].elements[i];  
				if (e.name==chkName){
					var chk = document.forms[0].elements[i];
					if(chk.checked){
						var bb = e.value; 
					    	selected.push(bb);
					    	break;
					} 
				}	 
			}	 
 		if(0!=selected.length){
 	
 			    f_a_ID='<c:out value="${param.flightInfoId}"/>';
 			    if(f_a_ID==null){
 			     f_a_ID='<c:out value="${flightInfoId}"/>';
 			    }
				document.forms[0].method="post";
				document.forms[0].action="./switchRecord.html?method=batchEdit&flightInfoId="+f_a_ID;
				document.forms[0].submit();
			//}else return;	  			
		}else{
			alert("<fmt:message key="common.batchEdit.message"/>");
		}	 
	}

</script>
</html> 